/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2022-10-16 17:18:07
 * @LastEditors: Clark
 * @LastEditTime: 2022-11-23 17:15:21
 * @Description: file content
 */

#include "src/network/server.h"
#include "muduo/base/Logging.h"
#include "muduo/net/EventLoop.h"
#include "src/common/common.h"
#include "src/protocol_business/protocol_business.h"

int main(int argc, char *argv[])
{
    LOG_INFO << "pid = " << getpid();
    if (argc > 1)
    {
        EventLoop loop;
        uint16_t port = static_cast<uint16_t>(atoi(argv[1]));
        InetAddress serverAddr(port);
        ChatServer server(&loop, serverAddr);

        if (argc > 2)
        {
            server.setThreadNum(atoi(argv[2]));
        }

        server.start();
        loop.loop();
    }
    else
    {
        printf("Usage: %s port\n", argv[0]);
    }

    return 0;
}
